In our recent model, the cooperation emerges as a positive feedback between a not-too-bad reputation and an altruistic attitude. Here we introduce a bias of altruism as to favorize members of the same group. The matrix F(i,j) of frequency of cooperation between agents i and j reveals the structure of communities. The Newman algorithm reproduces the initial bias. The method based on differential equations detects two groups of agents cooperating within their groups, leaving the uncooperative ones aside.